import type { R, TableDataInfo } from '@/api/model/resultModel';
import type { XyywOrderForm, XyywOrderQuery, XyywOrderVo } from '@/api/xyyw/model/orderModel';
import { request } from '@/utils/request';

// 查询订单列表
export function listOrder(query?: XyywOrderQuery) {
  return request.get<TableDataInfo<XyywOrderVo>>({
    url: '/xyyw/order/list',
    params: query,
  });
}

// 查询订单详细
export function getOrder(orderId: number) {
  return request.get<R<XyywOrderVo>>({
    url: `/xyyw/order/${orderId}`,
  });
}

// 新增订单
export function addOrder(data: XyywOrderForm) {
  return request.post<R<void>>({
    url: '/xyyw/order',
    data,
  });
}

// 修改订单
export function updateOrder(data: XyywOrderForm) {
  return request.put<R<void>>({
    url: '/xyyw/order',
    data,
  });
}

// 删除订单
export function delOrder(orderIds: number | Array<number>) {
  return request.delete<R<void>>({
    url: `/xyyw/order/${orderIds}`,
  });
}
